<?php
/**
 * File containing the BRail_Mail class.
 * @package BRail_Mail
 */

/**
 * @package BRail_Mail
 */
class BRail_Mail
{
    /**
     * Clean the mail address, scrap the internal server name in the e-mails
     * @param mixed $mailAddresses
     * @return mixed $mailAddresses
     */
    public static function cleanInternalEmail($mailAddresses)
    {
        if (is_array($mailAddresses)) {
            return array_map('BRail_Mail::cleanInternalEmail', $mailAddresses);
        }
        return preg_replace('/@.*\.(.*\.\w{2})/', '@$1', $mailAddresses);
    }
}
